STRATCONN-6780 - [Pinterest CAPI] - new events and fields#3820
STRATCONN-6780 - [Pinterest CAPI] - new events and fields#3820joe-ayoub-segment wants to merge 16 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for additional Pinterest Conversions API (CAPI) fields in the pinterest-conversions destination’s reportConversionEvent action, extending the mapped payload and updating tests/snapshots accordingly.
Changes:
- Expanded supported
event_namechoices and updated Pinterest event name constants. - Added new payload fields (
advertiser_tracking_enabled,app_info,device_info) and newcustom_datafields (content_*,predicted_ltv,np) to the outbound request payload. - Updated unit tests and snapshots to reflect the new payload shape.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/destination-actions/src/destinations/pinterest-conversions/reportConversionEvent/index.ts | Adds new action fields and includes them in the request payload mapping. |
| packages/destination-actions/src/destinations/pinterest-conversions/reportConversionEvent/generated-types.ts | Updates generated Payload typings for new fields. |
| packages/destination-actions/src/destinations/pinterest-conversions/reportConversionEvent/tests/index.test.ts | Updates assertions to validate new payload fields without full-body string equality. |
| packages/destination-actions/src/destinations/pinterest-conversions/reportConversionEvent/tests/snapshots/index.test.ts.snap | Updates snapshots to include newly added payload fields. |
| packages/destination-actions/src/destinations/pinterest-conversions/pinterest-capi-custom-data.ts | Adds new custom_data schema fields (including predicted_ltv). |
| packages/destination-actions/src/destinations/pinterest-conversions/constants.ts | Expands Pinterest event name constants and fixes SIGNUP value. |
- Map app_info.app_id to context.app.build - Map device_info.brand to context.device.manufacturer - Map device_info.carrier to context.network.carrier - Add window_height/window_width defaults to app_info - Change install_time to datetime with unix conversion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduces a `data_format` choice field that controls field visibility: - "Structured Fields" (default for new instances): shows flat custom data fields, contents array, app_info, and device_info objects - "Legacy Fields" (or undefined for existing instances): shows the original nested custom_data object and flat app/device fields Existing integrations are unaffected — they have no value for data_format (undefined), which is treated as legacy via depends_on conditions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- custom_data_2: object field with all custom data properties except contents - contents: standalone array field with proper @arrayPath default mapping - Both defined with depends_on DEPENDS_ON_STRUCTURED - custom_data_field_2 exported from pinterest-capi-custom-data.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Define PinterestEventPayload, LegacyPinterestEventPayload, CustomData, UserData, ContentsItem, AppInfo, DeviceInfo in types.ts - Wire up return types on buildCustomData and createPinterestPayload - Fix convertInstallTime to handle 0 correctly - Remove app_id and os_family default mappings - Add advertiser_tracking_enabled assertions to tests - Add test for undefined data_format (existing subscriptions) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/destination-actions/src/destinations/pinterest-conversions/reportConversionEvent/index.ts:439
- The user_data validation rejects payloads that only provide
phone, but the error message explicitly lists Phone Number as an accepted identifier. This can cause valid conversions (phone-only) to fail with a 400 IntegrationError.
if (
isEmpty(payload.user_data?.email) &&
isEmpty(payload.user_data?.hashed_maids) &&
!(payload.user_data?.client_ip_address && payload.user_data?.client_user_agent)
) {
There was a problem hiding this comment.
⚠️ Not ready to approve
There’s a confirmed timestamp conversion bug for numeric-string install_time inputs and a misleading user-facing error message that should be corrected for accuracy.
Copilot's findings
- Files reviewed: 8/8 changed files
- Comments generated: 3
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
| function convertInstallTime(value: string | number | undefined | null): number | undefined { | ||
| if (value === undefined || value === null || value === '') return undefined | ||
| if (typeof value === 'number') return value | ||
| const parsed = dayjs.utc(value) | ||
| if (!parsed.isValid()) return undefined | ||
| return parsed.unix() | ||
| } |
| async function processPayload(request: RequestClient, settings: Settings, payload: Payload) { | ||
| if ( | ||
| isEmpty(payload.user_data?.email) && |
| @@ -141,86 +99,506 @@ describe('PinterestConversionApi', () => { | |||
| ) | |||
| }) | |||
Pinterest CAPI destiantion - adding support for new events and fields.
contact, customize_product, find_location, initiate_checkout, schedule, start_trial, submit_application,
subscribe, view_content
custom_data.content_brand, custom_data.content_category, custom_data.content_name, custom_data.predicted_ltv,
custom_data.np, and contents[].item_brand, contents[].item_brand_id, contents[].item_category,
contents[].item_name
(standalone array with @arrayPath defaults from Segment ecommerce spec), app_info, and device_info
app_name, app_version, device_brand, device_carrier, device_model, device_type, os_version fields
legacy via depends_on conditions
Trial, Subscribe, View Content) mapped to Segment spec event names
partner_name)
LegacyPinterestEventPayload, CustomData, UserData, ContentsItem, AppInfo, DeviceInfo)
dates
Testing
To be tested in Staging
Unt test changes:
Removed:
Restructured existing tests:
behavior
New tests added:
no app_info/device_info)
- Verifies app_name is not required when data_format: 'latest' (succeeds without it)
- Verifies app_name is required when data_format: 'legacy' (throws without it)
Assertions added to existing tests:
Security Review
Please ensure sensitive data is properly protected in your integration.
type: 'password'New Destination Checklist
verioning-info.tsfile. example